package com.dl.service;

import com.dl.dao.StudentMapper;
import com.dl.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {

    @Autowired
    private StudentMapper studentMapper;

    public void getStu(){
        studentMapper.selStus();
    }

    public int addStudent(Student student){
        //开启事务
        //调用接口方法
        int count = studentMapper.insertStu(student);
        //提交事务

        return count;
    }

    public int addStudent(String sname,String spass){
        //开启事务
        System.out.println("插入学生2成功！");
        //提交事务

        return 1;
    }

    //查询所有学生
    public List<Student> getStus(){
        return studentMapper.selStus();
    }
}
